package org.sport.model.entityModel;

import javax.persistence.*;
import java.sql.Timestamp;
import java.util.Collection;

/**
 * Created by Allen on 2017/9/29.
 */
@Entity
@Table(name = "activitytable", schema = "sportinfo", catalog = "")
public class ActivitytableEntity {
    private int id;
    private String otherPeoId;
    private Timestamp createTime;
    private Timestamp beginTime;
    private Timestamp endTime;
    private String theam;
    private String location;
    private String totPeo;
    private Integer upperLimit;
    private String inviteeId;
    private String status;
    private String brief;
    private String icon;
    private UsertableEntity usertableByOwnerId;
    private Collection<ActlinuserEntity> actlinusersById;
    private Collection<DiscusstableEntity> discusstablesById;
    private Collection<ParacttableEntity> paracttablesById;

    @Id
    @Column(name = "_id", nullable = false)
    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    @Basic
    @Column(name = "otherPeoId", nullable = true, length = 45)
    public String getOtherPeoId() {
        return otherPeoId;
    }

    public void setOtherPeoId(String otherPeoId) {
        this.otherPeoId = otherPeoId;
    }

    @Basic
    @Column(name = "createTime", nullable = true)
    public Timestamp getCreateTime() {
        return createTime;
    }

    public void setCreateTime(Timestamp createTime) {
        this.createTime = createTime;
    }

    @Basic
    @Column(name = "beginTime", nullable = true)
    public Timestamp getBeginTime() {
        return beginTime;
    }

    public void setBeginTime(Timestamp beginTime) {
        this.beginTime = beginTime;
    }

    @Basic
    @Column(name = "endTime", nullable = true)
    public Timestamp getEndTime() {
        return endTime;
    }

    public void setEndTime(Timestamp endTime) {
        this.endTime = endTime;
    }

    @Basic
    @Column(name = "theam", nullable = true, length = 45)
    public String getTheam() {
        return theam;
    }

    public void setTheam(String theam) {
        this.theam = theam;
    }

    @Basic
    @Column(name = "location", nullable = true, length = 45)
    public String getLocation() {
        return location;
    }

    public void setLocation(String location) {
        this.location = location;
    }

    @Basic
    @Column(name = "totPeo", nullable = true, length = 45)
    public String getTotPeo() {
        return totPeo;
    }

    public void setTotPeo(String totPeo) {
        this.totPeo = totPeo;
    }

    @Basic
    @Column(name = "upperLimit", nullable = true)
    public Integer getUpperLimit() {
        return upperLimit;
    }

    public void setUpperLimit(Integer upperLimit) {
        this.upperLimit = upperLimit;
    }

    @Basic
    @Column(name = "inviteeId", nullable = true, length = 45)
    public String getInviteeId() {
        return inviteeId;
    }

    public void setInviteeId(String inviteeId) {
        this.inviteeId = inviteeId;
    }

    @Basic
    @Column(name = "status", nullable = true, length = 45)
    public String getStatus() {
        return status;
    }

    public void setStatus(String status) {
        this.status = status;
    }

    @Basic
    @Column(name = "brief", nullable = true, length = 45)
    public String getBrief() {
        return brief;
    }

    public void setBrief(String brief) {
        this.brief = brief;
    }

    @Basic
    @Column(name = "icon", nullable = true, length = 45)
    public String getIcon() {
        return icon;
    }

    public void setIcon(String icon) {
        this.icon = icon;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        ActivitytableEntity that = (ActivitytableEntity) o;

        if (id != that.id) return false;
        if (otherPeoId != null ? !otherPeoId.equals(that.otherPeoId) : that.otherPeoId != null) return false;
        if (createTime != null ? !createTime.equals(that.createTime) : that.createTime != null) return false;
        if (beginTime != null ? !beginTime.equals(that.beginTime) : that.beginTime != null) return false;
        if (endTime != null ? !endTime.equals(that.endTime) : that.endTime != null) return false;
        if (theam != null ? !theam.equals(that.theam) : that.theam != null) return false;
        if (location != null ? !location.equals(that.location) : that.location != null) return false;
        if (totPeo != null ? !totPeo.equals(that.totPeo) : that.totPeo != null) return false;
        if (upperLimit != null ? !upperLimit.equals(that.upperLimit) : that.upperLimit != null) return false;
        if (inviteeId != null ? !inviteeId.equals(that.inviteeId) : that.inviteeId != null) return false;
        if (status != null ? !status.equals(that.status) : that.status != null) return false;
        if (brief != null ? !brief.equals(that.brief) : that.brief != null) return false;
        if (icon != null ? !icon.equals(that.icon) : that.icon != null) return false;

        return true;
    }

    @Override
    public int hashCode() {
        int result = id;
        result = 31 * result + (otherPeoId != null ? otherPeoId.hashCode() : 0);
        result = 31 * result + (createTime != null ? createTime.hashCode() : 0);
        result = 31 * result + (beginTime != null ? beginTime.hashCode() : 0);
        result = 31 * result + (endTime != null ? endTime.hashCode() : 0);
        result = 31 * result + (theam != null ? theam.hashCode() : 0);
        result = 31 * result + (location != null ? location.hashCode() : 0);
        result = 31 * result + (totPeo != null ? totPeo.hashCode() : 0);
        result = 31 * result + (upperLimit != null ? upperLimit.hashCode() : 0);
        result = 31 * result + (inviteeId != null ? inviteeId.hashCode() : 0);
        result = 31 * result + (status != null ? status.hashCode() : 0);
        result = 31 * result + (brief != null ? brief.hashCode() : 0);
        result = 31 * result + (icon != null ? icon.hashCode() : 0);
        return result;
    }

    @ManyToOne
    @JoinColumn(name = "ownerId", referencedColumnName = "_id")
    public UsertableEntity getUsertableByOwnerId() {
        return usertableByOwnerId;
    }

    public void setUsertableByOwnerId(UsertableEntity usertableByOwnerId) {
        this.usertableByOwnerId = usertableByOwnerId;
    }

    @OneToMany(mappedBy = "activitytableByActId")
    public Collection<ActlinuserEntity> getActlinusersById() {
        return actlinusersById;
    }

    public void setActlinusersById(Collection<ActlinuserEntity> actlinusersById) {
        this.actlinusersById = actlinusersById;
    }

    @OneToMany(mappedBy = "activitytableByActivityId")
    public Collection<DiscusstableEntity> getDiscusstablesById() {
        return discusstablesById;
    }

    public void setDiscusstablesById(Collection<DiscusstableEntity> discusstablesById) {
        this.discusstablesById = discusstablesById;
    }

    @OneToMany(mappedBy = "activitytableByActId")
    public Collection<ParacttableEntity> getParacttablesById() {
        return paracttablesById;
    }

    public void setParacttablesById(Collection<ParacttableEntity> paracttablesById) {
        this.paracttablesById = paracttablesById;
    }
}
